package com.drondea.testclient.model;

/**
 * 数据模型枚举
 * @author shd
 */
public enum Model {
    /**
     * 用户接入信息
     */
    CT_USER("用户", "CT_USER", User.class),
    /**
     * 系统配置
     */
    APP_CONFIG("系统配置", "APP_CONFIG", AppConfig.class);

    Model(String name, String code, Class clazz) {
        this.name = name;
        this.code = code;
        this.clazz = clazz;
    }

    private String name;
    private String code;
    private Class clazz;

    /**
     * 根据编码获取对应的Class类型
     * 
     * @param code
     * @return
     */
    public static Class getClass(String code) {
        for (Model model : Model.values()) {
            if (model.code.equals(code)) {
                return model.clazz;
            }
        }
        return null;
    }

    public Class getClazz() {
        return clazz;
    }

    public void setClazz(Class clazz) {
        this.clazz = clazz;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }
}
